Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #5160 #5682

Merged
merged 3 commits into from
Jul 17, 2022
Merged

Fixes #5160 #5682

merged 3 commits into from
Jul 17, 2022

Conversation

KevinGrajeda
Copy link
Contributor

Changes:

Screenshots of the change:

PR Checklist

@welcome
Copy link

welcome bot commented May 27, 2022

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

@KevinGrajeda
Copy link
Contributor Author

@limzykenneth I would like to have a review on this pr, thank you👍

@KevinGrajeda
Copy link
Contributor Author

added a test for the validation of parameters in anglemode and now i dont have any failed tests

* @method angleMode
* @param {Constant} mode either RADIANS or DEGREES
*
* @chainable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function made chainable? For most p5.js API there isn't much sense for functions to be chainable as they usually are not exposed as object instance methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't know the use of chaining in this type of functions i just used other mode functions as a reference:

* @method rectMode
* @param {Constant} mode either CORNER, CORNERS, CENTER, or RADIUS
* @chainable

* @method ellipseMode
* @param {Constant} mode either CENTER, RADIUS, CORNER, or CORNERS
* @chainable

p5.js/src/color/setting.js

Lines 241 to 246 in e32b453

* @method colorMode
* @param {Constant} mode either RGB, HSB or HSL, corresponding to
* Red/Green/Blue and Hue/Saturation/Brightness
* (or Lightness)
* @param {Number} [max] range for all values
* @chainable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can @chainable be removed here? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's done

@limzykenneth
Copy link
Member

I'm not sure how this PR addresses #5160 which has more do to with push() and pop() instead of parameter validation.

@KevinGrajeda
Copy link
Contributor Author

In #5160 it was mentioned that adding return type to angleMode would be a solution

Adding a return to angleMode() call without argument should be a doable solution.
#5160 (comment)

if this doesn't solve that issue i think it's still useful having that return and the parameter validation was just missing.

@Qianqianye
Copy link
Contributor

Thanks @KevinGrajeda. Hey @limzykenneth, what do you think of the current status of this PR? Thank you!

@limzykenneth
Copy link
Member

Looks good. Thanks!

@Qianqianye
Copy link
Contributor

Thanks @KevinGrajeda and @limzykenneth

@Qianqianye
Copy link
Contributor

@all-contributors please add @KevinGrajeda for code

@allcontributors
Copy link
Contributor

@Qianqianye

I've put up a pull request to add @KevinGrajeda! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

angleMode not saved/restored by push/pop
3 participants